<template>
        <div class="app-container">
            <div class="customContainer">
                <!-- 头 -->
                <div class="customHeader">
                    <div>账目追回信息录入</div>
                    <div>追帐录入入口</div>
                </div>
                <!-- 搜索头 -->
                <el-form :inline="true" :model="formInline" ref="formInline" class="demo-form-inline" size="small">
                    <el-form-item label="　　　　日期">
                        <el-date-picker v-model="pickerDate" value-format="yyyy.MM.dd" type="date" placeholder="选择日期"></el-date-picker>
                    </el-form-item>
                    <br>
                    <el-form-item label="　　　　现金">
                        <el-input type="number"  onmousewheel="return false;" v-model="formInline.cash_actual" placeholder="请输入现金"></el-input>
                    </el-form-item>
                    <br>
                    <el-form-item label="银行卡总面额">
                        <el-input type="number"  onmousewheel="return false;" v-model="formInline.bank_actual" placeholder="银行卡总面额"></el-input>
                    </el-form-item>
                    <br>
                    <el-form-item label="　　　　备注">
                            <el-input type="textarea"  v-model="formInline.remark" placeholder="请输入备注"></el-input>
                        </el-form-item>
                        <br>
                    <el-form-item label="　　交账店员">
                        <el-select filterable placeholder="选择门店" v-model="formInline.store" @change="storeChange">
                            <el-option v-for="item in storeList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                        </el-select>
                        <el-select placeholder="选择店员" v-model="formInline.clerk">
                            <el-option v-for="item in clerkList" :key="item.id" :label="item.nick" :value="item.id"></el-option>
                        </el-select>
                    </el-form-item>
                    <br>
                    <el-form-item label="　　　　　　">
                        <el-button type="primary" @click="seveClick">确定</el-button>
                        <el-button @click="reset">重置</el-button>
                    </el-form-item>
                </el-form>
            </div>
        </div>
    </template>
    
    <script>
        import {
            getClerkList,
            getStoreList,
            save
        } from "@/api/finance/check";
        export default {
            data() {
                return {
                    machineInfo: '',
                    list: null,
                    listLoading: false,
                    pickerDate: new Date(Date.UTC((new Date().getFullYear()), new Date().getMonth(), new Date().getDate())).toISOString().slice(0, 10).replace('-', '.').replace('-', '.'),
                    storeList: [],
                    clerkList: [],
                    formInline: {
                        clerk: '',
                        store: '',
                        datetime: '',
                        cash_actual: '',
                        bank_actual: '',
                        remark:'',
                    },
                };
            },
            created() {
                this.getStore();
            },
            methods: {
                seveClick() {
                    this.formInline.datetime = this.pickerDate ? this.pickerDate : '';
                    save(this.formInline).then(response => {
                        this.$message({
                            type: response.code == 1 ? 'success' : 'error',
                            message: response.message
                        });
                    });
                },
                reset() {
                    this.formInline = {
                        clerk: '',
                        store: '',
                        datetime: '',
                        cash_actual: '',
                        bank_actual: '',
                    }
                },
                getStore() {
                    getStoreList({}).then(response => {
                        this.storeList = response;
                    });
                },
                storeChange() {
                    this.formInline.clerk = '';
                    this.formInline.datetime = this.pickerDate ? this.pickerDate : '';
                    getClerkList({ datetime: this.formInline.datetime, store: this.formInline.store }).then(response => {
                        this.clerkList = response;
                    });
                },
            }
        };
    </script>